cannot convert from 'cli::array<Type> ^' to 'cli::array<Type> ^[]'

Posted by user1576628 on Stack Overflow See other posts from Stack Overflow or by user1576628
Published on 2012-09-06T21:36:33Z Indexed on 2012/09/06 21:37 UTC
Read the original article Hit count: 591

Filed under:
|

I'm pretty new to C++/CLI and I am trying to convert a System::String to a System::Char array.

Here's what I have so far:

private: System::Void modeToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
             Mode frmMode;
             if(frmMode.ShowDialog() == System::Windows::Forms::DialogResult::OK){
                 array <Char>^ load [] = gcnew array<Char>(txtbxName->Text->ToCharArray());
             }
         }

txtbxName is a textbox inside a the form. Supposedly, this should work, but I get the compiler error:

error C2440: cannot convert from 'cli::array<Type> ^' to 'cli::array<Type> ^[]'

for the fourth line of the snippet.

© Stack Overflow or respective owner

Related posts about visual-studio-2005

Related posts about c++-cli